package com.kmzx.one.project.mapper;

import com.kmzx.one.project.entity.Warehouse;
import com.kmzx.one.project.entity.WarehouseDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
@Mapper
public interface WarehouseMapper {

    int insertWarehouse(Warehouse warehouse);

    int batchUpdateWarehouse(@Param("list") List<Warehouse> list);

    int batchUpdateWarehouseDetail(@Param("list") List<WarehouseDetail> list);

    int insertWarehouseDetail(WarehouseDetail warehouseDetail);

    int batchInsertWarehouseDetail(@Param("list") List<WarehouseDetail> list);

    Long selectProductStore(String skuId);

    List<Warehouse> selectWarehouseInfo(String skuId);

    List<WarehouseDetail> selectWarehouseInfoByOrderId(@Param("orderId") String orderId, @Param("states") Integer states);

    List<Warehouse> selectWarehouseInfos(List<String> list);

    Warehouse selectWarehouseByBatchSkuId(@Param("skuId") String skuId, @Param("batchNo") Integer batchNo);

    /**
     * 批量更新库存的状态
     *
     * @param list
     * @return
     */
    int batchSuccessWarehouseDetail(@Param("list") List<WarehouseDetail> list);

    int successWarehouseDetail(int states, Date updateTime, String orderId);
}
